package com.xiaoxi.example.consumer;

import com.xiaoxi.example.common.model.User;
import com.xiaoxi.example.common.service.UserService;
import com.xiaoxi.xirpc.bootstrap.ConsumerBootstrap;
import com.xiaoxi.xirpc.proxy.ServiceProxyFactory;

/**
 *  简易消费者示例
 */
public class EasyConsumerExample {

    public static void main(String[] args) {

        // 服务提供者初始化
        ConsumerBootstrap.init();

        UserService userService = ServiceProxyFactory.getProxy(UserService.class);
        User user = new User();
        user.setName("xiaoxi");
//        short number = userService.getNumber();
//        System.out.println(number);
        User newUser = userService.getUser(user);
        if (newUser != null){
            System.out.println(newUser.getName());
        }else {
            System.out.println("user == null");
        }



        User newUser1 = userService.getUser(user);
        if (newUser1 != null){
            System.out.println(newUser1.getName());
        }else {
            System.out.println("user1 == null");
        }
    }
}
